package com.rockywong.springcloud.controller;

import com.rockywong.springcloud.feign.UploadClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by rockywong on 2018/7/31.
 */
@RestController
public class UploadController {

    @Autowired
    private UploadClient client;

    @PostMapping(value = "/feign/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public int upload(@RequestPart(value = "file")MultipartFile file) {
        int r = client.upload(file);
        return r;
    }
}
